

import Vue from 'vue'
 

import {Loading} from 'element-ui'
 
 

export default function ({ $axios, redirect,store,req,route }) {
  let load;
  $axios.onRequest(config => {
    load = Loading.service({
      lock:true,
      fullscreen:true,
      text:"loading",
      spinner:"el-icon-loading",
      background:'rgba(255,255,255,0.7)'
    })
  
  
  })

  $axios.onResponse(r => {
    if(load){
       load.close();
    }
  })
  $axios.onError(error => {
    const code = parseInt(error.response && error.response.status)
    if(load){
       load.close();
    }
    if (code === 401) {
   
    }
  })
}